//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_HDD_FILE_H
#define _UX_HDD_FILE_H

#include "IFile.h"

namespace Engine
{
namespace FileSystem
{

	//
	// HDD File
	//

	class _EXPORT_ CFile : public IFile
	{
	protected:
		string			_sName;
		int				_iFile;
		e_rw_mode::type	_eRWmode;

	public:
		CFile();
		CFile(const char *pFileName, e_file_open_flags::type eFlags);
		virtual ~CFile();

		bool Open(const char *pFileName, e_file_open_flags::type eFlags);
		void Close();

		// IFile //
		virtual bool			IsOpen()	const	{ return ( _eRWmode != e_rw_mode::NOT_OPEN ); }
		virtual const string &	GetName()	const	{ return _sName; }
		virtual e_rw_mode::type	GetMode()	const	{ return _eRWmode; }

		virtual uint Read(void *pBuf, uint uSize);
		virtual uint Write(const void *pBuf, uint uSize);
		virtual uint Seek(uint uOffset, e_seek::type eSeekFlag);
		virtual uint GetSize() const;
		virtual uint GetPos()  const;
		
		virtual uint64 SeekL(uint64 uOffset, e_seek::type eSeekFlag = e_seek::CURRENT);
		virtual uint64 GetSizeL()	const;
		virtual uint64 GetPosL()	const;

		virtual e_file::type GetFileType()	const	{ return e_file::HDD; }

		// CEngBaseObject //
		virtual void Release();
	};

//-------------------------------------------------------------------

}	// FileSystem
}	// Engine

#endif	// _UX_HDD_FILE_H